package menu

import (
	"gitee.com/xgotool/backend-framework-template/service/users"
	"gitee.com/xiaoyutab/xgotool/individual/xginplus"
	"github.com/gin-gonic/gin"
)

// 获取我的菜单权限信息
//
//	GET	system/menu/my_info
func MyInfo(c *xginplus.Context) *xginplus.Response {
	user, err := users.Info(c.GetUint("uid"))
	if err != nil {
		return c.Error(err)
	}
	menu, err := users.MenuList(0)
	if err != nil {
		return c.Error(err)
	}
	pem, err := users.Pem(user.Id)
	if err != nil {
		return c.Error(err)
	}
	return c.Success(gin.H{
		"user": user,
		"menu": menu,
		"pem":  pem,
	})
}
